package com.example.simplenet.database;

import android.provider.BaseColumns;

public class ImperiaDatabaseContract {

	private ImperiaDatabaseContract() {}
	
	public static abstract class UserEntry implements BaseColumns {

        public static final String TABLE_NAME = "user";
        
        public static final String COLUMN_NAME_USERNAME = "username";
        public static final String COLUMN_NAME_POINTS = "points";
        public static final String COLUMN_NAME_DISTANCE = "distance";
        public static final String COLUMN_NAME_DATE = "date";
        public static final String COLUMN_NAME_DATE_INT = "dateInt";
	}

	private static final String TEXT_TYPE = " TEXT";
	private static final String NUMERIC_TYPE = " INTEGER";
	private static final String COMMA_SEP = ",";
	
	public static final String SQL_CREATE_ENTRIES =
	    "CREATE TABLE " + UserEntry.TABLE_NAME + " (" +
	    		UserEntry._ID + " INTEGER PRIMARY KEY," +
	    		UserEntry.COLUMN_NAME_USERNAME + TEXT_TYPE + COMMA_SEP +
	    		UserEntry.COLUMN_NAME_POINTS + NUMERIC_TYPE + COMMA_SEP +
	    		UserEntry.COLUMN_NAME_DISTANCE + NUMERIC_TYPE + COMMA_SEP +
	    		UserEntry.COLUMN_NAME_DATE_INT + NUMERIC_TYPE + COMMA_SEP +
	    		UserEntry.COLUMN_NAME_DATE + TEXT_TYPE + " )";

	public static final String SQL_DELETE_ENTRIES =
	    "DROP TABLE IF EXISTS " + UserEntry.TABLE_NAME;
	
	public static final String[] NAME_PROJECTION = new String []{
		UserEntry.COLUMN_NAME_USERNAME };
	
	public static final String[] GRAPH_PROJECTION = new String[] {
		UserEntry.COLUMN_NAME_DATE_INT, UserEntry.COLUMN_NAME_POINTS };
	
	public static final String[] OPTIMIZE_PROJECTION = new String[] {
		UserEntry._ID, UserEntry.COLUMN_NAME_POINTS, UserEntry.COLUMN_NAME_DATE_INT};
	
	public static final String DELETE_WHERE = UserEntry.COLUMN_NAME_USERNAME + " = ? AND "
		+ UserEntry.COLUMN_NAME_DATE_INT + " > ? AND " + UserEntry.COLUMN_NAME_DATE_INT + " < ?";
			
}
